package com.isyscore.controller.admin;


import com.isyscore.service.admin.SysMenuService;
import com.isyscore.service.admin.SysRoleMenuService;
import com.isyscore.utils.MesResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.security.Security;

/**
 * <p>
 * 角色和菜单关联表 前端控制器
 * </p>
 *
 * @author LGL
 * @since 2024年10月25日
 */
@RestController
@RequestMapping("/api/sysRoleMenu")
@Tag(name = "角色和菜单关联表管理", description = "角色和菜单关联表管理相关接口")
public class SysRoleMenuController {

    @Autowired
    private SysMenuService menuService;

    @GetMapping("/getMenus")
    @Operation(summary = "获取用户菜单")
    @RequiresPermissions("system:user:view")
    public MesResult getMenus(){
        return MesResult.success(menuService.getMenusByUserId((Long) SecurityUtils.getSubject().getPrincipal()));
    }


}

